var e = require;
var t = module;
var o = exports;
var ii, nn = this && this.__extends || (ii = function (t, e) {
    return (ii = Object.setPrototypeOf || {
        __proto__: []
    }
        instanceof Array &&
        function (t, e) {
            t.__proto__ = e
        } ||
        function (t, e) {
            for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
        })(t, e)
},
    function (t, e) {
        function o() {
            this.constructor = t
        }
        ii(t, e),
            t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
    }
),
    rr = this && this.__awaiter ||
        function (t, e, o, i) {
            return new (o || (o = Promise))(function (n, a) {
                function r(t) {
                    try {
                        l(i.next(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function s(t) {
                    try {
                        l(i.
                            throw(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function l(t) {
                    var e;
                    t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
                        t(e)
                    })).then(r, s)
                }
                l((i = i.apply(t, e || [])).next())
            })
        };
var oo = (this && this.__decorate) ||
    function (e, t, a, n) {
        var i,
            o = arguments.length,
            s = o < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, a)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);
        else
            for (var r = e.length - 1; r >= 0; r--)
                (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
        return o > 3 && s && Object.defineProperty(t, a, s), s;
    };
Object.defineProperty(o, "__esModule", { value: !0 });
var a = e("BaseModuleUI"),
    n = e("NotifyEventType"),
    i = e("GlobalParams"),
    r = e("AssetsManager"),
    s = e("Game"),
    l = cc._decorator,
    _ = l.ccclass,
    c = l.property,
    d = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.player_hand_sprite = null),
                (t.player_name_label = null),
                (t.player_level_sprite = null),
                (t.player_level_num = null),
                (t.player_exp_label = null),
                (t.exp_bar_mask = null),
                t
            );
        }
        return (
            nn(t, e),
            (t.prototype.initView = function () {
                this.showPlayerInfo(), this.updatePlayerLevel();
            }),
            (t.prototype.addEvent = function () {
                this.attachEvent(n.default.SEND_UPDATE_PLAYER_INFO, this.showPlayerInfo, this),
                    this.attachEvent(n.default.SEND_UPDATE_PLAYER_SEASON_LEVEL_INFO, this.updatePlayerLevel, this);
            }),
            (t.prototype.showPlayerInfo = function () {
                var e = i.GlobalParams.PlayerInfo.value;
                (this.player_hand_sprite.spriteFrame = r.default.getInstance().getHeroHeadFrame("hero_" + e.head)),
                    (this.player_name_label.string = "" + e.name);
            }),
            (t.prototype.updatePlayerLevel = function () {
                var e = i.GlobalParams.PlayerInfo.value,
                    t = Math.floor(e.level / 10);
                (t = t > 6 ? 6 : t),
                    (this.player_level_sprite.spriteFrame = r.default.getInstance().getPlayerLevelExp(t)),
                    (this.player_level_num.string = "Lv " + e.level);
                var o = e.exp,
                    a = s.default.season_exp[t];
                (this.player_exp_label.string = o + "/" + a), (this.exp_bar_mask.width = (180 * o) / a);
            }),
            oo([c(cc.Sprite)], t.prototype, "player_hand_sprite", void 0),
            oo([c(cc.Label)], t.prototype, "player_name_label", void 0),
            oo([c(cc.Sprite)], t.prototype, "player_level_sprite", void 0),
            oo([c(cc.Label)], t.prototype, "player_level_num", void 0),
            oo([c(cc.Label)], t.prototype, "player_exp_label", void 0),
            oo([c(cc.Node)], t.prototype, "exp_bar_mask", void 0),
            oo([_], t)
        );
    })(a.default);
o.default = d;
